
package controller.util;

import javafx.geometry.Rectangle2D;
import javafx.scene.image.Image;
import javafx.stage.Screen;
import javafx.stage.Stage;

/*
 * Define a resolução para uma stage de acordo com o monitor..
 */
public class Resolusao {

    private Rectangle2D bounds;

    private Resolusao() {
        Screen screen = Screen.getPrimary();
        bounds = screen.getVisualBounds();
    }

    public static Resolusao getInstance() {
        return ResolusaoHolder.INSTANCE;
    }

    private static class ResolusaoHolder {

        private static final Resolusao INSTANCE = new Resolusao();
    }

    public void setResolucao(Stage stage) {
        stage.setX(bounds.getMinX());
        stage.setY(bounds.getMinY());
        stage.setWidth(bounds.getWidth());
        stage.setHeight(bounds.getHeight());
        stage.getIcons().add(new Image("/resource/img/icon.png"));
        stage.setTitle("Rotulador de Imagem");
    }
}
